/*
day248
2020.5.2
*/ 
#include<cstdlib>
using namespace std;
struct TreeNode {
    int val;
	TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
public:
    TreeNode* removeLeafNodes(TreeNode* root, int target) {
		if(!root)
		{
			return nullptr;
		}
		
		TreeNode *l=removeLeafNodes(root->left,target);
		TreeNode *r=removeLeafNodes(root->right,target);
		
		
		if(!l && !r && root->val==target)
		{
			return nullptr;
		}
		
		root->left=l;
		root->right=r;
		return root;
    }
};




int main()
{
	return 0;
}

